package sany.iec.service;

import lombok.extern.slf4j.Slf4j;
import org.openmuc.j60870.ClientConnectionBuilder;
import org.openmuc.j60870.Server;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * @Author : 托马斯
 * @Date : 2025/6/26 17:29
 * @Description :
 */
@Slf4j
@Service
public class SendDataToServer {


    @Resource
    private SendFunctionService sendFunctionService;

    @Scheduled(initialDelay = 2000, fixedRate = 1000)
    public void sendDataToServer() throws IOException {
        boolean flag = Math.random() > 0.5;
        log.info("下遥控指令... {}", flag);
        sendFunctionService.sendDataToSinglePointCommand(1, flag);
        float f = (float) Math.random() * 100;
        log.info("下遥调指令... {}", f);
        sendFunctionService.sendDataToSetPointCommand(1, f);
    }


}
